
const domainName = getApp().globalData.domainName
const parameter = getApp().globalData.parameter
Page({

  /**
   * 页面的初始数据
   */
  data: {
 
  },

  view_chap_detail(e){
    getApp().get_vibration()
    let index = e.currentTarget.id
    let chap_id = this.data.chap_list[index].chap_id
    let chap_name = this.data.chap_list[index].chap_name
    wx.navigateTo({
      url: '/pages/students/chap_doti_rec/chap_doti_rec?chap_id=' + chap_id + '&jg_stu_id=' + this.data.jg_stu_id + '&stu_name=' + this.data.stu_name + '&chap_name=' + chap_name,
    })

  },

  page_init(jg_stu_id, chap_id_list){
    wx.request({
      url: domainName + '/stu_chapters_init',
      data: {jg_stu_id,chap_id_list:JSON.stringify(chap_id_list)},...parameter,
      success: res => {
        wx.hideLoading()
        this.setData({
          chap_list:res.data.chap_list
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    // console.log('options',options)
    var url_data = JSON.parse(decodeURIComponent(options.url_data))
    // console.log('url_data',url_data)
    this.data.jg_stu_id = url_data.jg_stu_id
    this.data.stu_name = url_data.stu_name
    this.data.chap_id_list = url_data.chap_id_list
    wx.setNavigationBarTitle({
      title: this.data.stu_name + '：练习册',
    })
    wx.showLoading()
    this.page_init(this.data.jg_stu_id,this.data.chap_id_list)
  },

  

})